package com.ruoyi.project.system.customer.deal.service.impl;

import javax.annotation.Resource;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ruoyi.common.utils.uniquekey.IdGererateFactory;
import com.ruoyi.project.system.customer.deal.mapper.CustomerDealMapper;
import com.ruoyi.project.system.customer.deal.domain.CustomerDeal;
import com.ruoyi.project.system.customer.deal.service.ICustomerDealService;
import com.ruoyi.common.utils.text.Convert;

/**
 * 客户成交Service业务层处理
 * 
 * @author f_baisi
 * @date 2020-08-29
 */
@Service
public class CustomerDealServiceImpl implements ICustomerDealService 
{
    @Resource
    private IdGererateFactory idGererateFactory;
    @Autowired
    private CustomerDealMapper customerDealMapper;

    /**
     * 查询客户成交
     * 
     * @param id 客户成交ID
     * @return 客户成交
     */
    @Override
    public CustomerDeal selectCustomerDealById(String id)
    {
        return customerDealMapper.selectCustomerDealById(id);
    }

    /**
     * 查询客户成交列表
     * 
     * @param customerDeal 客户成交
     * @return 客户成交
     */
    @Override
    public List<CustomerDeal> selectCustomerDealList(CustomerDeal customerDeal)
    {
        return customerDealMapper.selectCustomerDealList(customerDeal);
    }

    /**
     * 新增客户成交
     * 
     * @param customerDeal 客户成交
     * @return 结果
     */
    @Override
    public int insertCustomerDeal(CustomerDeal customerDeal)
    {
        customerDeal.setId(this.idGererateFactory.nextStringId());
        return customerDealMapper.insertCustomerDeal(customerDeal);
    }

    /**
     * 修改客户成交
     * 
     * @param customerDeal 客户成交
     * @return 结果
     */
    @Override
    public int updateCustomerDeal(CustomerDeal customerDeal)
    {
        return customerDealMapper.updateCustomerDeal(customerDeal);
    }

    /**
     * 删除客户成交对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteCustomerDealByIds(String ids)
    {
        return customerDealMapper.deleteCustomerDealByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除客户成交信息
     * 
     * @param id 客户成交ID
     * @return 结果
     */
    @Override
    public int deleteCustomerDealById(String id)
    {
        return customerDealMapper.deleteCustomerDealById(id);
    }
}
